package com.cqs.leetcode.queueStack;

import java.util.Stack;

class CQueue {
    Stack<Integer> stack1 = new Stack();
    Stack<Integer> stack2 = new Stack();

    public CQueue() {
    }

    public void appendTail(int value) {
        stack1.push(value);
    }

    public int deleteHead() {
        if (stack1.size() == 0) return -1;
        while (stack1.size() > 1) {
            stack2.push(stack1.pop());
        }
        int pop = stack1.pop();
        while (stack2.size() > 0) {
            stack1.push(stack2.pop());
        }
        return pop;
    }
}